import { Switch, Text } from 'react-native-paper'
import React from 'react'
import { Touchable, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native'

export default function SwitchItem(
    { text, value, onValueChange }:
        { text: string, value: boolean, onValueChange?: (value: boolean) => void }
) {
    return (
        <TouchableWithoutFeedback onPress={() => onValueChange && onValueChange(!value)}>
            <View
                className='flex flex-row items-center justify-between px-4 py-2'
            >
                <Text variant='titleMedium' className='text-white'>{text}</Text>
                <Switch
                    value={value}
                    onValueChange={onValueChange}
                />
            </View>
        </TouchableWithoutFeedback>
    )
}